home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / init.d / readahead < prev    next >
Text File  |  2008-10-27  |  2KB  |  70 lines

  1. #!/bin/sh -e
  2. ### BEGIN INIT INFO
  3. # Provides:          readahead
  4. # Required-Start:    
  5. # Required-Stop:
  6. # X-Start-Before:    mountkernfs hostname
  7. # Default-Start:     S
  8. # Default-Stop:
  9. # Short-Description: init script for readahead
  10. ### END INIT INFO
  11.  
  12. # Check the package is still installed
  13. [ -x /sbin/readahead-list ] || exit 0
  14.  
  15. # Get LSB functions
  16. . /lib/lsb/init-functions
  17. . /etc/default/rcS
  18.  
  19.  
  20. # Remember that any major changes to this script need to also be made to
  21. # readahead-desktop.init
  22.  
  23. # Remove the boot list to disable this readhead phase
  24. [ -r /etc/readahead/boot ] || exit 0
  25.  
  26. case "$1" in
  27.     start|restart|force-reload)
  28.     # This can take a while
  29.     if type usplash_write >/dev/null 2>&1; then
  30.         usplash_write "TIMEOUT 360" || true
  31.     fi
  32.  
  33.     # If "profile" is placed on the kernel command-line we watch the boot
  34.     # sequence and generate new readahead lists, rather than read the lists
  35.     if ! grep -q "profile" /proc/cmdline; then
  36.         log_begin_msg "Reading files needed to boot..."
  37.         if /sbin/start-stop-daemon --start --quiet \
  38.         --pidfile /var/run/readahead-list.bogus \
  39.         --startas /sbin/readahead-list -- -s /etc/readahead/boot; then
  40.         log_end_msg 0
  41.         else
  42.         log_end_msg $?
  43.         fi
  44.     else
  45.         echo 524288 > /proc/sys/fs/inotify/max_user_watches
  46.  
  47.         log_begin_msg "Preparing to profile boot sequence..."
  48.         if /sbin/start-stop-daemon --start --quiet \
  49.         --pidfile /var/run/readahead-watch.bogus \
  50.         --startas /sbin/readahead-watch -- -o /etc/readahead/boot; then
  51.         log_end_msg 0    
  52.         else
  53.         log_end_msg $? || true
  54.         fi 
  55.     fi
  56.  
  57.     if type usplash_write >/dev/null 2>&1; then
  58.         usplash_write "TIMEOUT 15" || true
  59.     fi
  60.     ;;
  61.     stop)
  62.     ;;
  63.     *)
  64.     echo "Usage: /etc/init.d/readahead {start|stop|restart|force-reload}"
  65.     exit 1
  66.     ;;
  67. esac
  68.  
  69. exit 0
  70.